Overview
The performance testing (perftest) plugin simulates high loads of Resources in RHQ. It is just like any other plugin written for RHQ and should be deployed as such.
The size of the environment is specified through the use of scenario files. A scenario describes the results of invocations against the plugin. For instance, the scenario will dictate how many Resources of each Resource type should be returned on a discovery. Thus, multiple scenario files may be written to simulate different environments.
Installation
The perftest plugin is found in subversion under trunk/modules/plugins/perftest. As of June 2011, it is included in the RHQ distribution; previously, it had to be separately built and deployed. Once the perftest plugin is deployed, it is configured at runtime through system properties. The bare minimum that must be specified is the name of the scenario to run. The scenario name is the name of the scenario XML file without the .xml extension and is specified by the following system property (substituting the actual scenario name as the value):
-Drhq.perftest.scenario=scenario-name
The above property tells the perftest plugin to load the scenario file named scenario-name.xml. This property is passed into the agent via the RHQ_AGENT_JAVA_OPTS environment variable.
Remember that the RHQ Server needs to have the perftest plugin deployed for the agents to get them. To deploy the plugin, copy the perftest plugin .jar to the plugins "dropbox" directory (<server-install-dir>/plugins/), or use the Administration>SystemConfiguration>Plugins page in the GUI.
Scenarios
Scenarios are XML files that adhere to the perftest-scenario.xsd schema. They indicate and configure the generator used to create the Resources. Configuring generators can be as simple as specifying how many of an item to return or can entail more complex environment modeling.
Some generators allow a property name to be specified instead of a hard-coded value. This allows the user to specify at agent runtime certain configuration values. For instance, the scenario configurable-1 allows the number of Resources to be specified through the property "rhq.perftest.server-a-count". Using this technique, the plugin does not need to be rebuilt with a new scenario for a different number of servers - the amount can be passed in at runtime. For example:
-Drhq.perftest.scenario=configurable-1 -Drhq.perftest.server-a-count=10 -Drhq.perftest.service-a-count=50
The above configuration will run the scenario file configurable-1.xml, resulting in 10 resources of type "server-a" and 50 child services of type "service-a" on each "server-a" Resource.
If you want to write your own scenario configuration XML file, put the .xml file inside the perftest plugin, next to the rest of the scenario .xml files. Then jar up the plugin once again and redeploy it.
Resource
A scenario can specify which resource types will return Resources on discovery. Each Resource type referenced as a Resource in the scenario must be defined in the plugin descriptor. When specifying a Resource type, a Resource generator must be provided. The following Resource generators are supported:
-
SimpleResourceGenerator - Configurable to indicate how many of the associated resource type to return. The amount of resources may be hard coded through the attribute "numberOfResources". Additionally, a property name may be specified for passing in this value at runtime through the "property" attribute. If specified, the generator will look for a property of the indicated name and use that value as the number of resources to return. This generator will return the exact same set of resources on each discovery, named using the resource type and a counter from 0 to the total number of resources.
Metrics
Metric handling is currently very coarse-grained in the perftest plugin. Each resource specified in the scenario may indicate a metric value generator. If one is specified, it will be used for all metrics on that resource type. If one is not specified, any calls to MeasurementFacet.getValues will return the same report as passed in without any measurement data added to it. The following metric generators are supported:
Plugin Configuration
By default, when new resources are detected, an empty configuration instance is used as the plugin configuration. A generator can be supplied to populate this configuration instance. Any of the configuration generators can be used to this end. The following configuration generators are supported:
-
SimpleConfigurationGenerator - Each property in the configuration definition is assigned a hard coded string value. This generator does not support numeric, or more generally any validated, properties. As such, the plugin descriptor should define the plugin configuration as containing only string properties.
Artifacts
An artifact generator should be specified for every artifact type that the scenario wants artifacts to be discovered. Only artifacts types that are referenced by a generator will have artifacts discovered; discoveries on other artifact types will find no artifacts. Additionally, when specifying an artifact generator, a revision generator may be specified. The following artifact generators are supported:
For each artifact generator, a revision generator may be specified. If one is not specified, a single revision will be discovered for each artifact returned in the system. The following revision generators are supported:
-
SimpleArtifactRevisionGenerator - This generator allows the scenario to specify how many new revisions will be returned for the artifact type. For instance, if the "numberOfRevisions" property is set to 3, the first three revision discoveries will return revisions; subsequent discoveries will show no change to the revision. The details for each revision are hard-coded to test values.
Example Scenario Specification
<resource type="server-a">
<simpleResourceGenerator numberOfResources="1"/>
<simpleNumericMeasurementGenerator/>
<simpleArtifactGenerator artifactType="artifact2" numberOfArtifacts="20">
<simpleArtifactRevisionGenerator numberOfRevisions="5"/>
</simpleArtifactGenerator>
</resource>
Limitations
The implementation of the scenario handling does not take into account the parent Resource type. It is just simpler to keep a cache mapped by Resource type name rather than maintaining the parent-child relationship. As such, each Resource type in the perftest plugin descriptor, regardless of parent, must be uniquely named. Note that the RHQ data model allows two resource types with different parents to have the same name; it is a limitation of the perftest plugin that this is not supported.